home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / msdos / mxmenu.zip / WINSUP.INC < prev    next >
Text File  |  1993-05-18  |  3KB  |  159 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Menu support routines.
  5.  
  6. ==========================================================
  7. EndComment
  8.  
  9.  
  10. ;----- Support routines for conditional menus
  11.  
  12. Var
  13.   VertLine = "┬││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││"
  14.   VertLine2 = "││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││"
  15.   VertLine3 = "┌─┴┴┴┴─┐"
  16.   VertLine4 = "└─┬┬┬┬─┘"
  17.   IndexString
  18.   MyGroups
  19.  
  20.  
  21. ;----- Init Code
  22.  
  23. OnScreenOnly ;limits choices to those on the screen only.
  24. AllowEsc
  25. AllowAbort Off
  26. UseArrows Off
  27. LookSetup
  28.  
  29. ;----- Code for Group Conditionals
  30.  
  31. if NetworkVersion
  32.    if NovConnection > 0
  33.       NovReadGroups(NovLoginName,MyGroups)    ;Read Groups user is in.
  34.       SortArray(MyGroups)
  35.    endif
  36. endif
  37.  
  38. ;----- Adds a choice to list
  39.  
  40. Procedure AddChoice (Prompt,TaskNum)
  41.    if TaskNum <> 0
  42.       IndexString[CurrentWindow + 1] = Left(IndexString[CurrentWindow + 1],NumberOfElements(Choices)) + Char(TaskNum + 64)
  43.    endif
  44.    AppendArray(Choices,Prompt)
  45. EndProc
  46.  
  47. ;----- Compares TaskNum to Choice
  48.  
  49. Procedure Task (TaskNum)
  50.    if Mid(IndexString[CurrentWindow],Ord(LastKey) - 64,1) = Char(TaskNum + 64)
  51.       Return LastKey
  52.    else
  53.       Return ""
  54.    endif
  55. EndProc
  56.  
  57. ;----- Returns True if in list
  58.  
  59. Procedure InGroup (Group)
  60.    Return PosInSortedList(UpperCase(Group),MyGroups) > 0
  61. EndProc
  62.  
  63. ;----- Windowing Support
  64.  
  65. Procedure CenterStretchBox (Header,Col,Row)
  66.    MakeBox(Header,Col,Row,True)
  67. EndProc
  68.  
  69.  
  70. Procedure CornerStretchBox (Header,Col,Row)
  71.    if Row = 0 then Row = 5
  72.    if Col = 0 then Col = 8 + (CurrentWindow - 3 * 4)
  73.    MakeBox(Header,Col,Row,False)
  74. EndProc
  75.  
  76.  
  77. ;------ MenuExit Procedure
  78.  
  79. Procedure LeaveMenu
  80.    DrawTheBox (ScreenWidth / 2 - 4,ScreenHeight / 2 - 1,13,HeightDifference + 2,'Exit Menu')
  81.    Writeln " Yes"
  82.    Write   " No"
  83.  
  84.    OnKey "Y"
  85.       |ExitMenu
  86.  
  87.    OnKey "N"
  88.       |LastKey = Esc
  89.  
  90. EndProc
  91.  
  92. ;------ Read a Text Line Procedure
  93.  
  94. Procedure ReadTextLine(St,Header,Col,Row)
  95. var AnswerLine
  96.    Choices[1] = ""
  97.    CenterStretchBox(Header,Col,Row)
  98.    Write " " St " "
  99.    TextColor(MenuCapColorFG,MenuBG)
  100.    AnswerLine = Readln
  101.    EraseTopWindow
  102.    Dispose Choices
  103.    Return AnswerLine
  104. EndProc
  105.  
  106. ;----- View a File
  107.  
  108. Procedure ViewFile (Name)
  109.    if Name = '' then Return
  110.    BoxHeader = ' Viewing ' + Name + ' '
  111.    Shadow Off
  112.    DrawBox 1 4 80 21
  113.    ClearKeyEvents
  114.    TextColor MenuHeaderFG MenuBG
  115.    ViewTextFile Name
  116. EndProc
  117.  
  118. ;----- Display Greek Columns
  119.  
  120. Procedure GreekColumns
  121.    TextColor GreekFG GreekBG
  122.    GotoXY 4,4
  123.    WriteVertical VertLine2
  124.    GotoXY 5,4
  125.    WriteVertical VertLine2
  126.    GotoXY 6,4
  127.    WriteVertical VertLine2
  128.    GotoXY 7,4
  129.    WriteVertical VertLine2
  130.    GotoXY ScreenWidth - 6,4
  131.    WriteVertical VertLine2
  132.    GotoXY ScreenWidth - 5,4
  133.    WriteVertical VertLine2
  134.    GotoXY ScreenWidth - 4,4
  135.    WriteVertical VertLine2
  136.    GotoXY ScreenWidth - 3,4
  137.    WriteVertical VertLine2
  138.    GotoXY 2,4
  139.    Write VertLine4
  140.    GotoXY ScreenWidth - 8,4
  141.    Write VertLine4
  142.    GotoXY 2,ScreenHeight - 1
  143.    Write VertLine3
  144.    GotoXY ScreenWidth - 8,ScreenHeight - 1
  145.    Write VertLine3
  146. EndProc
  147.  
  148. ;----- Show Item for Debugging
  149.  
  150. Procedure ShowMe (Item)
  151.    DrawBox 1 23 80 3
  152.    Write ' '
  153.    TextColor Yellow Cyan
  154.    Write Item
  155.    Wait 300
  156.    EraseTopWindow
  157. EndProc
  158.  
  159.